from sqlalchemy import Column, Integer, String, DateTime
from module_admin.entity.do.base import db


class File(db.Model):
    __tablename__ = 'sys_file'

    id = Column(Integer, primary_key=True, autoincrement=True, comment='主键')
    original_name = Column(String(255), nullable=False, default='', comment='原文件名')
    new_name = Column(String(255), nullable=False, default='', comment='新文件名')
    type = Column(String(255), nullable=False, default='', comment='类型')
    extension = Column(String(20), nullable=False, default='', comment='后缀名(如: txt、png、doc、java等)')
    path = Column(String(255), nullable=False, default='', comment='路径')
    url = Column(String(255), nullable=False, default='', comment='访问路径')
    size = Column(Integer, nullable=False, default=0, comment='文件大小')
    user_name = Column(String(20), nullable=False, default='', comment='上传用户')
    course_id = Column(Integer,  nullable=False, comment='课程ID')
    dealine = Column(String(255), nullable=False, default='', comment='时间')
    # course_name = Column(String(20), nullable=False, default='', comment='课程名称')
    create_by = Column(Integer, default=2, comment='创建人')
    update_by = Column(Integer, default=2, comment='更新人')
